package jkd.lrn.net.ams.core.codec;

import jkd.lrn.net.ams.core.message.MDRRequest;

import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolEncoderOutput;
import org.apache.mina.filter.codec.demux.MessageEncoder;

public class MDRRequestEncoder implements MessageEncoder<MDRRequest>{

	@Override
	public void encode(IoSession sesion, MDRRequest request, ProtocolEncoderOutput out) throws Exception {
		
		final IoBuffer buffer = IoBuffer.allocate(17);
		
		buffer.putInt(request.getMessageId());
		
		buffer.putInt(request.getEmployeeId());
		buffer.put(request.getMove());
		buffer.putLong(request.getTimeStamp());
		
		buffer.flip();
		out.write(out);
		
		
	}

	

	
}
